We present a novel general resource analysis for logic programs based onsized types. Sized types are representations that incorporate structural(shape) information and allow expressing both lower and upper bounds on thesize of a set of terms and their subterms at any position and depth. They alsoallow relating the sizes of terms and subterms occurring at different argumentpositions in logic predicates. Using these sized types, the resource analysiscan infer both lower and upper bounds on the resources used by all theprocedures in a program as functions on input term (and subterm) sizes,overcoming limitations of existing resource analyses and enhancing theirprecision. Our new resource analysis has been developed within the abstractinterpretation framework, as an extension of the sized types abstract domain,and has been integrated into the Ciao preprocessor, CiaoPP. The abstract domainoperations are integrated with the setting up and solving of recurrenceequations for inferring both size and resource usage functions. We show thatthe analysis is an improvement over the previous resource analysis present inCiaoPP and compares well in power to state of the art systems.
展开▼